﻿// Copyright (c) Microsoft Corporation.
// This sample code is provided "as is" without warranty of any kind. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace TransformTestApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string outputFileName = null;

            outputFileName = testCsvToXmlTransform();

            //outputFileName = testTxtToXmlTransform();

            Debugger.Break();
        }

        static string testCsvToXmlTransform()
        {
            string outputFileName = null;
            var transform = new FMInc.Transforms.CsvToXmlTransform();
            using (var inStream = System.IO.File.OpenRead(@"..\..\..\Car1.csv"))
            {
                outputFileName = System.IO.Path.GetTempFileName();
                using (var outStream = System.IO.File.OpenWrite(outputFileName))
                {
                    transform.Transform(inStream, outStream, null);
                }
            }

            return outputFileName;
        }

        static string testTxtToXmlTransform()
        {
            string outputFileName = null;
            var transform = new FMInc.Transforms.TxtToXmlTransform();
            using (var inStream = System.IO.File.OpenRead(@"..\..\..\RecallList.txt"))
            {
                outputFileName = System.IO.Path.GetTempFileName();
                using (var outStream = System.IO.File.OpenWrite(outputFileName))
                {
                    transform.Transform(inStream, outStream, null);
                }
            }

            return outputFileName;
        }
    }
}
